Welcome to the deleq package!

This is a short document to demonstrate the use of the deleq package and its commands. It uses . deleq was written by Mats Dahlgren (matsd@physchem.kth.se). Suggestions for improvements and bug reports are most welcome, see the documentation. deleq is fully compatible with the leqno option.

We start this demonstration by a simple and well-known equation to get the equation number counter going:

sin2α + cos2α = 1 (1)
The first example will be to make use of the deqn environment to get a partially numbered equation:
\begin{deqn}
\sin (-\alpha) = - \sin \alpha
\end{deqn}
This equation has its cosine companion, here written in the ddeqn environment:
\begin{ddeqn}
\cos (-\alpha) = \cos \alpha
\end{ddeqn}
Not so exciting, so far. :–)

In the next example we introduce the deqarr environment for writing equations:
\begin{deqarr}
\sin ( \alpha + \beta ) & =
& \sin \alpha \cos \beta + \sin \be...
...a - \beta ) & =
& \sin \alpha \cos \beta - \sin \beta \cos \alpha
\end{deqarr}
where we also have put in the label Demo1 in the second equation. Next, notice how the environment ddeqar uses the same main equation number as the previous equations:
\begin{ddeqar}
\cos ( \alpha + \beta ) & =
& \cos \alpha \cos \beta - \sin \al...
...a - \beta ) & =
& \cos \alpha \cos \beta + \sin \alpha \sin \beta
\end{ddeqar}
Now, we will make another eqnarray-like structure, again in the ddeqar environment:
\begin{ddeqar}
\sin 2\alpha & =
& 2 \sin \alpha \cos \alpha \heqno
\\
\cos 2...
...- \sin ^2 \alpha \nydeqno \\
\rem{or}
& = & 2\cos ^2 \alpha - 1
\end{ddeqar}
This example shows the use of \heqno in the first equation, which produces an ordinary equation number. The first equation is also labelled, with the label Demo2. The next equation's number was produced by the command \nydeqno. Also, notice the use of \rem{or}, which results in the text ``or'' without changing the alignment.

To step the equation number counter, we want the following equations typeset in ordinary eqnarray environment:

tan2α = $\displaystyle {\frac{{\sin ^2 \alpha}}{{\cos ^2 \alpha}}}$ (2)
tanα = $\displaystyle {\frac{{\sin \alpha}}{{\cos \alpha}}}$ (3)

The upper equation was given the label Demo3.

Now one of the ``recycling'' commands is to be demonstrated. First of all, let's make an ordinary reference to equation [*], and then ``recycle'' it:

sin 2α = 2 sinαcosα$\displaystyle \reqno$Demo2

This was obtained with $$ ... $$ with the command \reqno{Demo2} at the end. Also partially numbered equations can be recycled with the \reqno{FOO} command, as with equation [*]:

sin(α - β) = sinαcosβ - sinβcosα$\displaystyle \reqno$Demo1

(However, the use of \rndeqno{FOO} and \rdeqno{FOO} will produce strange results with two (different) partial equation numbers if FOO refers to a partially numbered equation.)

The next equation was written with $$ ... $$ and a \deleqno command at the end:

tan 2α = $\displaystyle {\frac{{2\tan \alpha}}{{1 - \tan ^2 \alpha}}}$$\displaystyle \deleqno$

Notice how the main equation number counter is still the same, despite that we now are outside of the ddeqar environment. Also, notice how the use of \reqno above did not affect the equation number counter. The following equation is also set within $$ ... $$, but it uses the command \nydeleqno to produce an equation number with a new main number:

sin2α = 1 - cos2α$\displaystyle \nydeleqno$

Now we will elaborate a little on \rndeqno{FOO} and \rdeqno{FOO}. Let us use equation [*], and see what happens if we use the \rndeqno{FOO} command:

tan2α = $\displaystyle {\frac{{\sin ^2 \alpha}}{{\cos ^2 \alpha}}}$$\displaystyle \rndeqno$Demo3

which we rewrite:

tan2α = $\displaystyle {\frac{{\sin ^2 \alpha}}{{1 - \sin ^2 \alpha}}}$$\displaystyle \rdeqno$Demo3

with \rdeqno{Demo3} at the end. This is great fun, so why not one more:

tan2α = $\displaystyle {\frac{{1 - \cos ^2 \alpha}}{{\cos ^2 \alpha}}}$$\displaystyle \rdeqno$Demo3

Also, the middle form of equation [*] got a label, Demo4.

There is still one equation to write. This time we again use the deqarr environment:
\begin{deqarr}
\cot \alpha & = & \frac{\cos \alpha}{\sin \alpha} \\
\where
& = & \frac{1}{\tan \alpha}
\end{deqarr}
This example also shows the use of the \where command, which is a special case of the \rem command. Now, the interesting thing of referring to the recycled equations is ahead. If one writes \ref{Demo4}, this is what LATEX will return: [*]. That is not too instructive, since the partial equation numbers are quite common in this document. To make the complete reference, use \ref{Demo3}\ref{Demo4}. The reference [*][*] is much more comprehensible, right? (If you get bad line-breaks at such references, put them in an \mbox{...}.)

Finally, the $\mathcal {END}$! If you want your equations left-aligned, just specify the leqno option for the documentclass you are using. It should work! If you have any suggestions, corrections or contributions, please contact me. Enjoy LATEX!

mats d.